<?
function frameworkAutoloader($name) {
	if(in_array('Smarty',explode('_',$name))) return;	
        
    $name .='.php';    
    $matched = explode('\\',$name);
    $matched[0]=strtolower($matched[0]);
    
    if( $matched[0] != 'api')
    {
        for($i=1; $i < count($matched)-1; $i++)
        {
            $matched[$i]=strtolower($matched[$i]);
        }
    }
    
    $name = implode('/', $matched);
    
    $file = BASE_PATH.'/'.$name;
	if(! file_exists($file)) 
		throw new Exception("AUTOLOAD: UNKNOWN FILE ". $file);
	if(defined('SANDBOX') && SANDBOX == true)	
	   print $name.'<br/>';
       		
	include_once BASE_PATH.'/'.$name;
}

spl_autoload_register('frameworkAutoloader');
?>